{% set namespace = "acs_global_acceleration" %}
{% set dff_api_title = "AlibabaCloud-GA Collection" %}
{% set dff_api_crontab = "* * * * *" %}

{% extends "base_template" %}
{% block import %}
{{ super() }}
import integration_alibabacloud_ga_basic__main as basic_main
import integration_alibabacloud_ga_standard__main as standard_main
import integration_alibabacloud_monitor__main as monitor_main
{% endblock %}

{% block account %}
{{ super() }}
{% endblock %}

{% block collect_configs %}
collector_configs = {
    'regions': {{ repr(collector.regions) }}
}

base_monitor_configs = {
    'targets': [
        {
            'namespace': {{ repr(namespace) }},
            {% if collector.base_metrics %}
            'metrics'  : {{ repr(collector.base_metrics) }}
            {% else %}
            'metrics'  : []
            {% endif %}
        }
    ]
}

standard_monitor_configs = {
    'targets': [
        {
            'namespace': {{ repr(namespace) }},
            {% if collector.standard_metrics %}
            'metrics'  : {{ repr(collector.standard_metrics) }}
            {% else %}
            'metrics'  : []
            {% endif %}
        }
    ]
}
{% endblock %}

{% block filters%}
{% endblock %}

{% block run %}
@DFF.API('{{ dff_api_title }}', timeout=300, fixed_crontab='{{ dff_api_crontab }}')
def run():
    collectors = [
        basic_main.DataCollector(account, collector_configs),
        monitor_main.DataCollector(account, base_monitor_configs),
        standard_main.DataCollector(account, collector_configs),
        monitor_main.DataCollector(account, standard_monitor_configs)
    ]
    Runner(collectors).run()
{% endblock %}
